var a = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1
    },
    onLoad: function(a) {
        this.getListData();
    },
    getListData: function() {
        var t = this, o = a.getNetAddresss("goods.goods.get-limit-buy-goods");
        a._postNetWork({
            url: o,
            data: {
                page_size: 10
            },
            success: function(o) {
                var e = o.data;
                if (1 != e.result) return a.tips(e.msg);
                t.data.total_page = e.data.last_page, t.data.total_page || (t.data.total_page = 0), 
                t.setData({
                    listData: e.data.data,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var o = a.getNetAddresss("goods.goods.get-limit-buy-goods"), e = {
                page: this.data.page,
                page_size: 10
            };
            a._postNetWork({
                url: o,
                data: e,
                success: function(a) {
                    var o = a.data;
                    if (t.data.isLoadMore = !0, 1 === o.result) {
                        var e = t.data.listData.concat(o.data.data);
                        t.setData({
                            listData: e
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});